package org.example.chapter3;

import java.util.Scanner;

public class SentineValue {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter an integer ( the input ends if it is 0 ): ");
      /*  int data=in.nextInt();
        int sum=0;
        while(data!=0){
            sum+=data;
            System.out.println("Enter an integer ( the input ends if it is 0 ): ");
            data=in.nextInt();
        }*/
        int data;
        int sum=0;
        do{
            System.out.println("Enter an integer ( the input ends if it is 0 ): ");
            data = in.nextInt();
            sum+=data;
        }while (data!=0);

        System.out.println("The sum of an integer is "+sum);
    }
}
